home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4347 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  36 lines

  1. Path: news.bos.nl!port04
  2. From: lmfridael@wnet.bos.nl (L.M. Fridael)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: SIGNAL statement(???)
  5. Date: Mon, 29 Jan 96 23:32:13 GMT
  6. Organization: Bos Internet Services
  7. Distribution: world
  8. Message-ID: <4ejeqd$ueb@Wnet.bos.nl>
  9. NNTP-Posting-Host: port04.bos.nl
  10. X-Newsreader: News Xpress Version 1.0 Beta #2
  11.  
  12. In Dr. DOBBS Sourcebook Nov/Dec 95 I came across a puzzling piece of code in an article describing a CGI library.
  13.  
  14. (Comments by me)
  15. ***
  16. #include <signal.h>
  17. #include <unistd.h>
  18. #include "cgi-lib.h"
  19.  
  20. int main()
  21. {  signal(SIGALRM, die); // Upon raising the SIGALRM signal it calls the DIE() function?
  22.    alarm(30); // Does this raise the SIGALRM signal after 30 seconds?
  23.    while(1) ; // just an infinite loop
  24. }
  25. ***
  26. Does this work? I haven't been able to test it out. Apparently my Borland compiler doesn't have UNISTD installed(???)
  27.  
  28. I'm working on a CGI processing class and I want to implement functionality to exit the program in case the user presses the 'Stop' button before the CGI-program has finished or the program goes into an infinte loop due to a flaw/bug in program design.
  29. (This issue was of course pointed out by the author of the Dobb article. I hadn't thought of it myself)
  30.  
  31.  
  32. Thanks a lot in advance,
  33. -Laurence
  34.  
  35. PS. The CGI-programs run on a Unix server. (I use Windows at home)
  36.